<template>
  <a href="javascript:;" class="primary-btn">
    <IconSvg
      v-if="icon_front"
      :iconClass="icon_front"
      class="icon icon_front"
    ></IconSvg>
    <span>{{ btn_text }}</span>
    <IconSvg
      v-if="icon_end"
      :iconClass="icon_end"
      class="icon icon_end"
    ></IconSvg>
  </a>
</template>

<script>
import IconSvg from '@/components/IconSvg';
export default {
  name: 'Button',
  components: {
    IconSvg
  },
  props: {
    // 文字前图标，没有传递就代表没有图标
    icon_front: {
      default: '',
      type: String
    },
    // 文字后图标，没有传递就代表没有图标
    icon_end: {
      default: '',
      type: String
    },
    btn_text: {
      default: '按钮',
      type: String
    }
  }
};
</script>

<style lang="less" scoped>
a {
  padding: 8px 12px;
  font-size: 1.3rem;
  height: 100%;
  display: inline-block;
  &.primary-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.3rem;
    color: #18191c;
    border: 1px solid #d3d5d7;
    background-color: #fff;
    margin-left: 8px;
    box-sizing: border-box;
  }
  &:hover {
    background-color: #e3e5e7;
  }
  span {
    margin: 0 5px;
  }
  .icon {
    font-size: 1.2rem;
  }
  .icon_end {
    position: relative;
    top: 1px;
  }
}
</style>
